<template>
  <div class="header">
    <div class="logo">医疗标记系统--{{this.info}}</div>
    <el-menu :router="true" mode="horizontal" class="menu">
      <el-menu-item @click="home" index="/">首页</el-menu-item>
      <el-menu-item @click="logout">退出登录</el-menu-item>
    </el-menu>
  </div>
</template>

<script>
// const info = localStorage.getItem('info');

export default {
  name: "CommonHeader",
  data() {
    return {
      info: localStorage.getItem('sysName')
    };
  },
  methods: {
    logout() {
      // 清除用户信息和token等
      localStorage.removeItem('token'); // 假设你用localStorage存储token
      this.$router.push('/login');
    },

    home(){
      this.$router.push({
                    name: "Home",
                });
    }
  }
};
</script>

<style scoped>
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 100%;
  color: #fff;
}

.logo {
  font-size: 30px;
  font-weight: bold;
}

.menu {
  display: flex;
  font-weight: bold; 
}
</style>